<template>
  <div class="">
    <el-descriptions :direction="tableParams.direction" :title="tableParams.title" :column="tableParams.column" border>
      <el-descriptions-item :width="perWidth ?? ''" :label="item.label" v-for="(item, index) in tableParams.data">{{
        item.val }}</el-descriptions-item>
    </el-descriptions>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'

const props = defineProps({
  tableParams: new Object({
    direction: String,
    widthAverage: Number || String,
    title: String,
    column: Number || String,
    data: [
      {
        label: '',
        val: ''
      }
    ]
  })
})

const perWidth = ref('')
const getWidth = () => {
  // const { widthAverage, column } = props.tableParams
  const column = props.tableParams.column
  const widthAverage = props.tableParams.widthAverage
  if (widthAverage) perWidth.value = `${(100 / column).toFixed(2)}%`
}
getWidth()
</script>
<style lang="scss" scoped>
.tab-title {
  font-size: 20px;
  color: #303133;
  font-weight: bold;
  margin-top: 50px;
  text-align: center;
}
</style>
